<?php

/* 属性 attribute */
class AuthoperatorModel extends BaseModel
{
	var $table  = 'authoperator';
	var $prikey = 'zao_tid';
	var $_name  = 'authoperator';

	/**
	 * 获取认证数据
	 * $type  0 实名认证	1 车辆认证 2 运营商认证
	 * @param unknown_type $user_id  用户编号
	 * @param unknown_type $type     认证类型
	 */
	function getAuth($user_id) {
	if (!$user_id)
        {
            $this->_error('no_such_user');
            return false;
        }
        	$auth=$this->getAll("SELECT
								zys_authoperator.zao_tid AS a_tid,
								zys_authoperator.zao_usertid AS a_userid,
								zys_authoperator.zao_otid,
								zys_authoperator.zao_operator_code AS a_operator_code,
								zys_authoperator.zao_apply_date AS a_apply_date,
								zys_authoperator.zao_authed AS a_authed,
								zys_authoperator.zao_auth_opid AS a_auth_opid,
								zys_authoperator.zao_auth_date AS a_auth_date,
								zys_operator.o_name
								from zys_authoperator left join zys_operator on zao_otid=o_tid
        					    where zao_usertid=$user_id ");

		$list=array();
		if(!empty($auth)){
			foreach($auth as $k=>$v){
				$list[]=$v;
			}
		}
		return $list;
	}
	function operatorAuth($userid,$code){
		
		if(empty($code)){
			return $this->get("zao_usertid=$userid ");
		}
		return $this->get("zao_usertid=$userid and zao_operator_code='$code'");
	}
}

?>